package com.ruanyun.modular.admin.controller;

import com.ruanyun.base.pojo.page.LayuiPageInfo;
import com.ruanyun.modular.admin.entity.TExhaustEquipment;
import com.ruanyun.modular.admin.model.params.TExhaustEquipmentParam;
import com.ruanyun.modular.admin.model.result.TExhaustEquipmentResult;
import com.ruanyun.modular.admin.service.TExhaustEquipmentService;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.core.reqres.response.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;


/**
 * 废气治理设施控制器
 *
 * @author 
 * @Date 2021-04-17 16:39:56
 */
@Controller
@RequestMapping("/tExhaustEquipment")
public class TExhaustEquipmentController extends BaseController {

    private String PREFIX = "/tExhaustEquipment";

    @Autowired
    private TExhaustEquipmentService tExhaustEquipmentService;

    /**
     * 跳转到主页面
     *
     * @author 
     * @Date 2021-04-17
     */
    @RequestMapping("")
    public String index() {
        return PREFIX + "/tExhaustEquipment.html";
    }

    /**
     * 新增页面
     *
     * @author 
     * @Date 2021-04-17
     */
    @RequestMapping("/add")
    public String add() {
        return PREFIX + "/tExhaustEquipment_add.html";
    }

    /**
     * 编辑页面
     *
     * @author 
     * @Date 2021-04-17
     */
    @RequestMapping("/edit")
    public String edit() {
        return PREFIX + "/tExhaustEquipment_edit.html";
    }

    /**
     * 新增接口
     *
     * @author 
     * @Date 2021-04-17
     */
    @RequestMapping("/addItem")
    @ResponseBody
    public ResponseData addItem(TExhaustEquipmentParam tExhaustEquipmentParam) {
        return this.tExhaustEquipmentService.add(tExhaustEquipmentParam);
    }

    /**
     * 编辑接口
     *
     * @author 
     * @Date 2021-04-17
     */
    @RequestMapping("/editItem")
    @ResponseBody
    public ResponseData editItem(TExhaustEquipmentParam tExhaustEquipmentParam) {
        return this.tExhaustEquipmentService.update(tExhaustEquipmentParam);
    }

    /**
     * 删除接口
     *
     * @author 
     * @Date 2021-04-17
     */
    @RequestMapping("/delete")
    @ResponseBody
    public ResponseData delete(TExhaustEquipmentParam tExhaustEquipmentParam) {
        return this.tExhaustEquipmentService.updateDelFlagById((long)tExhaustEquipmentParam.getId());
    }

    /**
     * 查看详情接口
     *
     * @author 
     * @Date 2021-04-17
     */
    @RequestMapping("/detail")
    @ResponseBody
    public ResponseData detail(TExhaustEquipmentParam tExhaustEquipmentParam) {
        TExhaustEquipmentResult detail = this.tExhaustEquipmentService.getDetail(tExhaustEquipmentParam.getId());
        return ResponseData.success(detail);
    }

    /**
     * 查询列表
     *
     * @author 
     * @Date 2021-04-17
     */
    @ResponseBody
    @RequestMapping("/list")
    public LayuiPageInfo list(TExhaustEquipmentParam tExhaustEquipmentParam) {
        return this.tExhaustEquipmentService.findPageBySpec(tExhaustEquipmentParam);
    }

    /**
     * 启用
     *
     * @author 
     * @Date 2021-04-17
     */
    @ResponseBody
    @RequestMapping("/enable")
    public ResponseData enable(@RequestParam Long id) {
        return this.tExhaustEquipmentService.enableById(id);
    }

    /**
     * 禁用
     *
     * @author 
     * @Date 2021-04-17
     */
    @ResponseBody
    @RequestMapping("/disable")
    public ResponseData disable(@RequestParam Long id) {
        return this.tExhaustEquipmentService.disableById(id);
    }

}


